import request from '../utils/request'
import config from '../utils/config'
import { splitStr } from './common'

// 获取个人资料
export function getUserInfo(params) {
    const urlStr = '/user/info'
    const url = process.env.NODE_ENV === 'production' ? config.BaseUrl + urlStr : urlStr;
    return request({
      url,
      method: 'get',
      params: splitStr(params)
    })
  }

// 更新个人资料
export function editInfo(data) {
    let urlStr = '/user/editInfo'
    const url = process.env.NODE_ENV === 'production' ? config.BaseUrl + urlStr : urlStr;
    return request({
      url,
      method: 'post',
      data: data
    })
  }

// 需改密码
export function editPassword(data) {
  let urlStr = '/user/editPassword'
  const url = process.env.NODE_ENV === 'production' ? config.BaseUrl + urlStr : urlStr;
  return request({
    url,
    method: 'post',
    data: data
  })
}


// 绑定手机号码
export function bindPhone(data) {
  let urlStr = '/user/bindPhone'
  const url = process.env.NODE_ENV === 'production' ? config.BaseUrl + urlStr : urlStr;
  return request({
    url,
    method: 'post',
    data: data
  })
}
